local M = {}

M.general = {
	n = {
		[";"] = { ":", "enter command mode", opts = { nowait = true } },

		--  format with conform
		["<leader>fm"] = {
			function()
				require("conform").format()
			end,
			"formatting",
		},

		["=="] = {
			function()
				require("conform").format()
			end,
			"formatting",
		},

		["ca"] = {
			function()
				vim.lsp.buf.code_action()
			end,
			"LSP code action",
		},

		["cc"] = {
			function()
				require("Comment.api").toggle.linewise.current()
			end,
			"Comment this line",
		},

		["<leader>s"] = { "<cmd> w <CR>", "Save file" },

		["<leader>nf"] = { "<cmd> NvimTreeFocus<CR>", "NvimTree Focus" },
		["<leader>ns"] = { "<cmd> NvimTreeToggle<CR>", "NvimTree Show" },

		["<leader>q"] = {
			"<cmd> qa <CR>",
			"Quit all",
		},
		["<leader>mp"] = { "<Plug>MarkdownPreview <CR>", "Markdown Preview" },

		["Y"] = { "y$" },
		["L"] = { "$" },
		["H"] = { "^" },
	},

	v = {
		[">"] = { ">gv", "indent" },
		["J"] = { ":m '>+1<CR>gv=gv" },
		["K"] = { ":m '<-2<CR>gv=gv" },
		["=="] = {
			function()
				require("conform").format()
			end,
			"formatting",
		},
		["cc"] = {
			"<ESC><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<CR>",
			"Toggle comment",
		},
	},
}

-- more keybinds!

return M
